#ifndef __VideoRecord_
#define __VideoRecord_

#include "../connect/MediaConnect.h"

#ifdef __cplusplus
extern "C"
{
#endif

#define MEDIA_VIDEO_STREAM_MAIN                        "main"
#define MEDIA_VIDEO_STREAM_SUB                         "sub"
#define MEDIA_VIDEO_DATA_MAX_SUBSCRIBER                8

typedef struct {
    int action;
    int numMsg;
    char strMsg[2048];
    void *msg;
}MsgObject;

typedef struct{
    char tag[32];
    char streamType[16];
    char taskCode[64];
    char wsUrl[256];
    int wsPort;
    int state;
    MediaDataCallback dataCallback;
}VideoSubscribeTask;

int video_record_load_moudle();

VideoSubscribeTask *video_record_find_task_by_code(const char *taskCode);

/**
 * @desc  开始订阅MediaServer视频服
 * @param tag                 订阅TAG
 * @param streamType          流的类型，"main" or "sub"
 * @param dataCallback        视频数据回调接口
 * */
int video_record_subscribe_start(const char *tag, const char *streamType, MediaDataCallback dataCallback);

/**
 * @desc  结束订阅MediaServer视频服
 * @param tag                 订阅TAG
 * */
int video_record_subscribe_finish(const char *tag);

/**
 * @desc  配置MS视频流的参数
 * @param streamType          流的类型，"main" or "sub"
 * @param definition          清晰度
 * @param bitRate             码率
 * @param frameRate           帧率
 * */
int video_record_config_stream_param(const char *streamType, int definition, int bitRate, int frameRate);

int video_record_release();

void video_record_write_data_to_file(char *recvMsg, int msgLength);
void video_log(bool enable);
#ifdef __cplusplus
}
#endif

#endif